package es.osoco.basicpomodoro.preferences;

import es.osoco.basicpomodoro.R;
import android.content.SharedPreferences;
import android.content.SharedPreferences.OnSharedPreferenceChangeListener;
import android.os.Bundle;
import android.preference.EditTextPreference;
import android.preference.PreferenceActivity;
import android.preference.PreferenceScreen;

public class PomodoroPreferences extends PreferenceActivity implements OnSharedPreferenceChangeListener {
	
    public static String KEY_NOTIFICATION_TITLE  = "PREF_NOTIFICATION_TITLE";
    public static String KEY_NOTIFICATION_SUMMARY = "PREF_NOTIFICATION_SUMMARY";

    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);

        setPreferenceScreen(this.createPreferenceHierarchy());
        
        // Set up a listener whenever a key changes            
        getPreferenceScreen().getSharedPreferences().
        registerOnSharedPreferenceChangeListener(this);
    }

    private PreferenceScreen createPreferenceHierarchy() {
        // Root
        PreferenceScreen root = getPreferenceManager().createPreferenceScreen(this);               
        
        EditTextPreference notificationTitle = new EditTextPreference(this);
        notificationTitle.setTitle(R.string.notificationTitlePrefTitle);
        notificationTitle.setSummary(R.string.notificationTitlePrefSummary);
        notificationTitle.setKey(KEY_NOTIFICATION_TITLE);
        root.addPreference(notificationTitle);
        
        EditTextPreference notificationSummary = new EditTextPreference(this);
        notificationSummary.setTitle(R.string.notificationSummaryPrefTitle);
        notificationSummary.setSummary(R.string.notificationSummaryPrefSummary);
        notificationSummary.setKey(KEY_NOTIFICATION_SUMMARY);
        root.addPreference(notificationSummary);

        return root;
    }

	@Override
	public void onSharedPreferenceChanged(SharedPreferences sharedPreferences,
			String key) {
		// TODO Auto-generated method stub
		
	}
}
